home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.2r / card_16247.txt < prev    next >
Text File  |  1989-02-26  |  1KB  |  42 lines

  1. -- card: 16247 from stack: in.2r
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 2202
  5. -- name: NumberofChars
  6. ----- HyperTalk script -----
  7. function NumberOfChars theChar, theString
  8. put 0 into charCount
  9. put first character of theChar into theChar -- strip
  10. repeat with i = 1 to the length of theString
  11.   if character i of theString is theChar then add 1 to charCount
  12. end repeat
  13. return charCount
  14. end NumberOfChars
  15.  
  16.  
  17.  
  18.  
  19. -- part contents for background part 10
  20. ----- text -----
  21. 3
  22.  
  23. -- part contents for background part 2
  24. ----- text -----
  25. --
  26. -- NumberOfChars -- utility function that tells you how many times a
  27. -- character turns up in a string
  28. --
  29. function NumberOfChars theChar, theString
  30.   put 0 into charCount
  31.   put first character of theChar into theChar -- strip
  32.   repeat with i = 1 to the length of theString
  33.     if character i of theString is theChar then add 1 to charCount
  34.   end repeat
  35.   return charCount
  36. end NumberOfChars
  37.  
  38.  
  39.  
  40. -- part contents for background part 3
  41. ----- text -----
  42. NumberofChars